﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage/MasterPage.Master" AutoEventWireup="true" CodeBehind="BGM_Request.aspx.cs" Inherits="KPIS.GERP.GBMS.APP_UI.BGM_Request" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>

<%@ Register src="../Controls/Panel/UserPanel.ascx" tagname="UserPanel" tagprefix="uc3" %>
<%@ Register src="../Controls/Panel/BroadcastPanel.ascx" tagname="Broadcast" tagprefix="uc7" %>
<%@ Register src="../Controls/Combo/YearCombo.ascx" tagname="year" tagprefix="uc8" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<link rel="StyleSheet" href="../../Styles/StyleSheet.css" type="text/css" />

<telerik:RadWindowManager 
    ID="RadWindowManager1" 
    ShowContentDuringLoad="false" 
    VisibleStatusbar="false" 
    ReloadOnShow="true" 
    runat="server" 
    Modal="true"
    Style="z-index: 7001"
    Skin="Web20">
    <Windows>
        <telerik:RadWindow 
            ID="Project" 
            runat="server" 
            AutoSize="true"
            OnClientClose="closeRadWindow">
        </telerik:RadWindow>
            <%--Width="1030px" 
            Height="680px"--%>
        <telerik:RadWindow 
            ID="BIRequest" 
            runat="server" 
            AutoSize="true"
            OnClientClose="closeRadWindow">
        </telerik:RadWindow>
            <%--Width="1000px" 
            Height="550px"--%>
        <telerik:RadWindow 
            ID="CopyBgmRequest" 
            runat="server" 
            AutoSize="true"
            OnClientClose="closeRadWindow">
        </telerik:RadWindow>
            <%--Width="810px" 
            Height="520px"--%>
        <telerik:RadWindow Title="รายงาน"
            runat="server" ID="Popup"
            ReloadOnShow="True" Width="100px" Height="100px">
        </telerik:RadWindow>
        <telerik:RadWindow ID="TaskLists" runat="server" Width="1000px" Behaviors="Reload, Close" 
            Height='<%# Unit.Pixel(new SsMng().GetUssI(SsMng.SsUserType.Height) - 100) %>'>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>  

 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">

        //var bodyOverflow, htmlOverflow; function closeHandler(sender, args) { document.body.style.overflow = bodyOverflow; document.documentElement.style.overflow = htmlOverflow; sender.remove_close(closeHandler); }
        //function OpenPopUpHideParentScrollBar(url, radwindowId) {bodyOverflow = document.body.style.overflow;htmlOverflow = document.documentElement.style.overflow;document.body.style.overflow = "hidden";document.documentElement.style.overflow = "hidden";var oWnd = radopen(url, radwindowId);oWnd.add_close(closeHandler);}

        function openPopup() {
            OpenPopUpHideParentScrollBar("~/Reports/RPT_Exports.aspx", "Popup");
        }
        
        function openProjectDetails() {
            var comboYear = $find('<%= ddlYear.ClientID %>');
            var comboJobSite = $find('<%= ddlJobSite.ClientID %>');
            if (comboJobSite.get_selectedIndex() != null && comboJobSite.get_selectedIndex() != 0) {
                var oWnd = OpenPopUpHideParentScrollBar("BGM_Project1.aspx?year=" + comboYear.get_value() + "&id=" + comboJobSite.get_value() + "&type=rq", "Project");
                var height = isNaN(window.innerHeight) ? window.clientHeight : window.innerHeight;
                oWnd.SetHeight(height);
            }
            else {
                alert("กรุณาระบุหน่วยงาน");
            }
        }
        
        function openBIRequest() {
            var comboYear = $find('<%= ddlYear.ClientID %>');
            var comboJobSite = $find('<%= ddlJobSite.ClientID %>');
            if (comboJobSite.get_selectedIndex() != null && comboJobSite.get_selectedIndex() != 0) {
                OpenPopUpHideParentScrollBar("BI_BGM_Request.aspx?year=" + comboYear.get_value() + "&id=" + comboJobSite.get_value() + "&type=rq", "BIRequest");
            }
            else {
                alert("กรุณาระบุหน่วยงาน");
            }
        }

        function openCopyBgmRequest() {
            var comboYear = $find('<%= ddlYear.ClientID %>');
            var comboJobSite = $find('<%= ddlJobSite.ClientID %>');
            if (comboJobSite.get_selectedIndex() != null && comboJobSite.get_selectedIndex() != 0) {
                OpenPopUpHideParentScrollBar("Copy_BGM_Request.aspx?year=" + comboYear.get_value() + "&id=" + comboJobSite.get_value() + "&type=rq", "CopyBgmRequest");
            }
            else {
                alert("กรุณาระบุหน่วยงาน");
            }
        }

        function closeRadWindow(sender, args) {
            return false;
        }
        
        function onTextChange(sender) {
            if (sender.get_value() == "") {
                sender.set_text("");
            }
        } 

        var cancelDropDownClosing = false;
        function OnClientDropDownClosingHandler(sender, e) {
            e.set_cancel(cancelDropDownClosing);
        }
        function StopPropagation(e) {
            e.cancelBubble = true;
            if (e.stopPropagation) {
                e.stopPropagation();
            }
        }
    
    </script>
 </telerik:RadCodeBlock>

 <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" >
 </telerik:RadAjaxLoadingPanel>

<telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="ddlJobSite">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="panel2" LoadingPanelID="RadAjaxLoadingPanel1"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="ddlFilterRecordStatus">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="panel2" LoadingPanelID="RadAjaxLoadingPanel1"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="ddlYear">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="panel2" LoadingPanelID="RadAjaxLoadingPanel1"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="gridProject">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="gridProjectByOption" LoadingPanelID="RadAjaxLoadingPanel1"/>
                <telerik:AjaxUpdatedControl ControlID="gridSource" LoadingPanelID="RadAjaxLoadingPanel1"/>
            </UpdatedControls>
        </telerik:AjaxSetting>
   </AjaxSettings>
</telerik:RadAjaxManager>

<table style="width: 1000px; height: 100%;" cellpadding="0" cellspacing="0">
<%--<tr>
<td width="274px" valign="top">
    <uc3:UserPanel ID="UserCtrl" runat="server" />
</td>
<td valign="top">
    <uc7:Broadcast ID="BroadcastCtrl" runat="server" />
</td>
</tr>--%>
<tr>
<td valign="top" colspan="2">
    <%--<div class="Background980">
    <div class="BackgroundBottom980">--%>
            <asp:Panel ID="panelHeader" runat="server">
                <div class="header-grid">
                    <asp:Label ID="lblHeader" runat="server" Text="คำของบประมาณ"></asp:Label>
                </div>
            </asp:Panel>
            <asp:Panel ID="panel1" runat="server" Width="1000px" ScrollBars="None">
            <table width="100%">
            <tr>
            <td valign="top" width="25%" style="border-right-style: groove; border-right-width: inherit; padding-right: 20px;">
                <ul class="formList">
                    <li>
                        <table>
                            <tr>
                                <td width="30%">
                                    <asp:Label ID="Label1" runat="server" Text="ปี :"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td width="70%">
                                    <telerik:RadComboBox ID="ddlYear" runat="server" Width="200px" 
                                        CssClass="textbox-string" 
                                        onselectedindexchanged="ddlYear_SelectedIndexChanged" AutoPostBack="True">
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                        </table>
                        <table>
                            <tr>
                                <td width="30%">
                                    <asp:Label ID="Label2" runat="server" Text="หน่วยงาน :"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td width="70%">
                                    <telerik:RadComboBox ID="ddlJobSite" runat="server" Visible="true" OnSelectedIndexChanged="ddlJobSite_SelectedIndexChanged"
                                        AllowCustomText="true" CausesValidation="false" DataTextField="text" AutoPostBack="true"
                                        DataValueField="value" EmptyMessage=" พิมพ์ที่นี่เพื่อค้นหาหน่วยงาน " 
                                        Filter="Contains" OnClientTextChange="onTextChange" Width="100%">
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                        </table>
                        <table>
                            <tr>
                                <td>
                                    
                                </td><asp:Button ID="btnLoadProject" runat="server" Text="แสดงรายละเอียดโครงการ" 
                                        Width="200px" OnClientClick="openProjectDetails(); return false;"/>
                            </tr>
                        </table>
                        <table>
                            <tr>
                                <td>
                                    <asp:Button ID="btnCopyProject" runat="server" Text="คัดลอกโครงการเก่า" 
                                        Width="200px" OnClientClick="openCopyBgmRequest(); return false;"/>
                                </td>
                            </tr>
                        </table>
                    </li>
                    <li>
                        <table>
                            <tr>
                                <td>
                                    กรองข้อมูลเพื่อออกรายงาน
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <telerik:RadComboBox ID="ddlRecordStatus" runat="server" AutoPostBack="true" Width="100%"
                                        OnSelectedIndexChanged="ddlRecordStatus_SelectedIndexChanged">
                                        <Items>
                                            <telerik:RadComboBoxItem Value="W" Text="ทั้งหมด" Selected="true" />
                                            <telerik:RadComboBoxItem Value="P" Text="ส่งคำขอให้ผอ. แล้ว" />
                                            <telerik:RadComboBoxItem Value="A" Text="อนุมัติแล้ว" />
                                        </Items>
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <telerik:RadComboBox runat="server" ID="cbSource" Width="100%"
                                        DataTextField="text" DataValueField="value">
                                    </telerik:RadComboBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:RadioButtonList ID="rblExpenseLevel" runat="server">
                                        <asp:ListItem Text="ระดับรายการค่าใช้จ่าย" Value="2" Selected="True" />
                                        <asp:ListItem Text="ระดับค่าใช้จ่าย" Value="1"  />
                                    </asp:RadioButtonList>
                                </td>
                            </tr>
                        </table>
                        <table>
                            <tr>
                                <td>
                                    <asp:Button ID="btnExportExcel" runat="server" Text="ค่าใช้จ่ายรายกิจกรรมย่อย (excel)" 
                                        Width="200px" onclick="btnExportExcel_Click" />
                                </td>
                            </tr>
                        </table>
                        <table>
                            <tr>
                                <td>
                                    <asp:Button ID="btnExportExcel2" runat="server" Text="ค่าใช้จ่ายรายโครงการ (excel)" 
                                        Width="200px" onclick="btnExportExcel2_Click" />
                                </td>
                            </tr>
                        </table>
                    </li>
                    <li>
                        <table>
                            <tr>
                                <td>
                                    <asp:Button ID="btnBiRequest" runat="server" Text="แสดงกราฟ" 
                                        Width="200px" OnClientClick="openBIRequest(); return false;" />
                                </td>
                            </tr>
                        </table>     
                    </li>
                </ul>
            </td>
            <td align="left" valign="top" style="padding-left: 10px; padding-top: 10px">
                <asp:Panel ID="panel2" runat="server">
                    <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="gridProject" runat="server"
                        OnSelectedIndexChanged="gridProject_SelectedIndexChanged"
                        AutoGenerateColumns="False" OnItemDataBound="gridProject_ItemDataBound" 
                        GridLines="None" MasterTableView-GridLines="None" ClientSettings-EnablePostBackOnRowClick="true"
                        Width="100%">
                        <MasterTableView ShowFooter="true" ShowGroupFooter="true" NoMasterRecordsText="... ไม่มีข้อมูล ..."
                            commanditemdisplay="none" width="100%" GroupLoadMode="Client" GroupsDefaultExpanded="true">
                            <Columns>
                                <telerik:GridBoundColumn DataField="bgm_strat_list_seq" Visible="false"
                                    FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                    HeaderText="รหัสกิจกรรมย่อย" ItemStyle-HorizontalAlign="Left" 
                                    UniqueName="bgm_strat_list_seq" >
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Left" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="name"
                                    FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                    HeaderText="กิจกรรมย่อย" ItemStyle-HorizontalAlign="Left" 
                                    UniqueName="name" >
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Left" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="total_amount"
                                    Aggregate="Sum"
                                    FooterText="รวมทั้งหมด : "
                                    DataFormatString="{0:#,##0.00}"
                                    HeaderStyle-HorizontalAlign="Center"
                                    HeaderText="วงเงิน(บาท)"
                                    UniqueName="total_amount" Visible="true">
                                    <HeaderStyle HorizontalAlign="Center" Width="80px"/>
                                    <FooterStyle HorizontalAlign="Right" />
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                            </Columns>
                            <GroupByExpressions>
                                <telerik:GridGroupByExpression>
                                    <GroupByFields>
                                        <telerik:GridGroupByField FieldName="output_seq" HeaderText="&nbsp;" />
                                    </GroupByFields>
                                    <SelectFields>
                                        <telerik:GridGroupByField FieldName="output_name" HeaderText="ผลผลิต :" HeaderValueSeparator="" />
                                    </SelectFields>
                                </telerik:GridGroupByExpression>
                                <telerik:GridGroupByExpression>
                                    <GroupByFields>
                                        <telerik:GridGroupByField FieldName="act_seq" HeaderText="&nbsp;" />
                                    </GroupByFields>
                                    <SelectFields>
                                        <telerik:GridGroupByField FieldName="act_name" HeaderText="กิจกรรมหลัก :" HeaderValueSeparator="" />
                                    </SelectFields>
                                </telerik:GridGroupByExpression>
                            </GroupByExpressions>
                        </MasterTableView>
                        <clientsettings>
                            <clientevents /><selecting allowrowselect="True" />
                        </clientsettings>
                    </telerik:RadGrid>
                    <br />
                    <table cellpadding="0" cellspacing="0" width="100%">
                        <tr>
                            <td width="49%" valign="top">
                                <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="gridSource" runat="server"
                                    AutoGenerateColumns="False" OnItemDataBound="gridSource_ItemDataBound"
                                    GridLines="None" MasterTableView-GridLines="None" 
                                    Width="100%">
                                    <mastertableview ShowFooter="true" NoMasterRecordsText="... ไม่มีข้อมูล ..." commanditemdisplay="none" datakeynames="bgm_source_seq" width="100%">                                                           
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="bgm_source_name"
                                            FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                            HeaderText="แหล่งเงิน" ItemStyle-HorizontalAlign="Left" 
                                            UniqueName="bgm_source_name" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="total_amount" 
                                            Aggregate="Sum"
                                            FooterAggregateFormatString="{0:#,##0.00}"
                                            DataFormatString="{0:#,##0.00}"
                                            HeaderStyle-HorizontalAlign="Center"
                                            HeaderText="วงเงิน(บาท)" 
                                            UniqueName="total_amount" Visible="true">
                                            <HeaderStyle HorizontalAlign="Center" Width="80px"/>
                                            <FooterStyle HorizontalAlign="Right" />
                                            <ItemStyle HorizontalAlign="Right" />
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                    </mastertableview>
                                    <clientsettings>
                                        <clientevents />
                                    </clientsettings>
                                </telerik:RadGrid>
                            </td>
                            <td width="2%">

                            </td>
                            <td width="49%" valign="top">
                                <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="gridBgmExpGrp" runat="server"
                                    AutoGenerateColumns="False" OnItemDataBound="gridBgmExpGrp_ItemDataBound"
                                    GridLines="None" MasterTableView-GridLines="None" 
                                    Width="100%">
                                    <mastertableview ShowFooter="true" NoMasterRecordsText="... ไม่มีข้อมูล ..." commanditemdisplay="none" datakeynames="bgm_exp_grp_seq" width="100%">                                                           
                                    <Columns>
                                        <telerik:GridBoundColumn DataField="bgm_exp_grp_name"
                                            FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                            HeaderText="งบรายจ่าย" ItemStyle-HorizontalAlign="Left" 
                                            UniqueName="bgm_exp_grp_name" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Left" />
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn DataField="total_amount" 
                                            Aggregate="Sum"
                                            FooterAggregateFormatString="{0:#,##0.00}"
                                            DataFormatString="{0:#,##0.00}"
                                            HeaderStyle-HorizontalAlign="Center"
                                            HeaderText="วงเงิน(บาท)" 
                                            UniqueName="total_amount" Visible="true">
                                            <HeaderStyle HorizontalAlign="Center" Width="80px"/>
                                            <FooterStyle HorizontalAlign="Right" />
                                            <ItemStyle HorizontalAlign="Right" />
                                        </telerik:GridBoundColumn>
                                    </Columns>
                                    </mastertableview>
                                    <clientsettings>
                                        <clientevents />
                                    </clientsettings>
                                </telerik:RadGrid>
                            </td>
                        </tr>
                    </table>
                    
                    <br />
                    <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="gridProjectDtls" runat="server"
                        OnSelectedIndexChanged="gridProjectDtls_SelectedIndexChanged"
                        AutoGenerateColumns="False" OnItemDataBound="gridProjectDtls_ItemDataBound"
                        GridLines="None" MasterTableView-GridLines="None" ClientSettings-EnablePostBackOnRowClick="true"
                        Width="100%">
                        <mastertableview ShowFooter="true" NoMasterRecordsText="... ไม่มีข้อมูล ..." CommandItemDisplay="none" DataKeyNames="Sequence" width="100%" ShowGroupFooter="true">                                                           
                            <Columns>
                                <telerik:GridBoundColumn DataField="bgm_prj_name"
                                    FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                    HeaderText="โครงการ" ItemStyle-HorizontalAlign="Left" 
                                    UniqueName="bgm_prj_name" >
                                    <HeaderStyle HorizontalAlign="Center" />
                                    <ItemStyle HorizontalAlign="Left" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="total_amount" 
                                    Aggregate="Sum"
                                    FooterAggregateFormatString="{0:#,##0.00}"
                                    DataFormatString="{0:#,##0.00}"
                                    HeaderStyle-HorizontalAlign="Center"
                                    HeaderText="วงเงิน(บาท)" 
                                    UniqueName="total_amount" Visible="true">
                                    <HeaderStyle HorizontalAlign="Center" Width="80px"/>
                                    <FooterStyle HorizontalAlign="Right" />
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                            </Columns>
                            <GroupByExpressions>
                                <telerik:GridGroupByExpression>
                                    <GroupByFields>
                                        <telerik:GridGroupByField FieldName="prj_type_seq" HeaderText="&nbsp;" />
                                    </GroupByFields>
                                    <SelectFields>
                                        <telerik:GridGroupByField FieldName="prj_type_name" HeaderText="ประเภทโครงการ :" HeaderValueSeparator="" />
                                    </SelectFields>
                                </telerik:GridGroupByExpression>
                            </GroupByExpressions>
                        </mastertableview>
                        <ClientSettings>
                            <Selecting AllowRowSelect="True" />
                        </ClientSettings>
                    </telerik:RadGrid>
                    <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="gridProjectByOption" runat="server"
                        AutoGenerateColumns="False" OnItemDataBound="gridProjectByOption_ItemDataBound"
                        GridLines="None" MasterTableView-GridLines="None" 
                        Width="100%" Visible="false">
                        <mastertableview ShowFooter="true" ShowGroupFooter="true" NoMasterRecordsText="... ไม่มีข้อมูล ..." commanditemdisplay="none" width="100%" GroupLoadMode="Client" GroupsDefaultExpanded="false">                                                           
                        <Columns>
                            <telerik:GridBoundColumn DataField="name"
                                FilterControlWidth="100%" HeaderStyle-HorizontalAlign="Center" 
                                HeaderText="โครงการบูรณาการ" ItemStyle-HorizontalAlign="Left" 
                                UniqueName="name" >
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Left" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="total_amount"
                                Aggregate="Sum"
                                FooterText="รวมทั้งหมด : "
                                DataFormatString="{0:#,##0.00}"
                                HeaderStyle-HorizontalAlign="Center"
                                HeaderText="วงเงิน(บาท)"
                                UniqueName="total_amount" Visible="true">
                                <HeaderStyle HorizontalAlign="Center" Width="80px"/>
                                <FooterStyle HorizontalAlign="Right" />
                                <ItemStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                        </Columns>
                        </mastertableview>
                        <clientsettings>
                            <clientevents />
                        </clientsettings>
                    </telerik:RadGrid>
                    <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="gridMarket" runat="server"
                        OnItemDataBound="gridMarket_ItemDataBound" 
                        AutoGenerateColumns="False" GridLines="None" MasterTableView-GridLines="None" 
                        Width="100%" Visible="false">
                        <mastertableview ShowFooter="true" NoMasterRecordsText="... ไม่มีข้อมูล ..." commanditemdisplay="none" datakeynames="bgm_option_seq" width="100%">                                                           
                        <Columns>
                            <telerik:GridBoundColumn DataField="bgm_option_name"
                                HeaderStyle-HorizontalAlign="Center" 
                                HeaderText="ตลาด(ภูมิภาค/ประเทศ)" ItemStyle-HorizontalAlign="Left" 
                                UniqueName="bgm_option_name">
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Left" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="weight" HeaderStyle-Width="15%"
                                Aggregate="Sum"
                                FooterAggregateFormatString="{0:#,##0}"
                                DataFormatString="{0:#,##0.000}"
                                HeaderStyle-HorizontalAlign="Center" 
                                HeaderText="น้ำหนัก" ItemStyle-HorizontalAlign="Right" 
                                UniqueName="weight">
                                <HeaderStyle HorizontalAlign="Center" />
                                <FooterStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="total_amount" 
                                Aggregate="Sum"
                                FooterAggregateFormatString="{0:#,##0.00}"
                                DataFormatString="{0:#,##0.00}"
                                HeaderStyle-HorizontalAlign="Center"
                                HeaderText="วงเงิน(บาท)" 
                                UniqueName="total_amount" Visible="true">
                                <HeaderStyle HorizontalAlign="Center" Width="80px"/>
                                <FooterStyle HorizontalAlign="Right" />
                                <ItemStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                        </Columns>
                        </mastertableview>
                    </telerik:RadGrid>
                    <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="gridProduct" runat="server"
                        OnItemDataBound="gridProduct_ItemDataBound" 
                        AutoGenerateColumns="False" GridLines="None" MasterTableView-GridLines="None" 
                        Width="100%" Visible="false">
                        <mastertableview ShowFooter="true" NoMasterRecordsText="... ไม่มีข้อมูล ..." commanditemdisplay="none" datakeynames="bgm_option_seq" width="100%">                                                           
                        <Columns>
                            <telerik:GridBoundColumn DataField="bgm_option_name"
                                HeaderStyle-HorizontalAlign="Center" 
                                HeaderText="สินค้า/บริการ" ItemStyle-HorizontalAlign="Left" 
                                UniqueName="bgm_option_name">
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemStyle HorizontalAlign="Left" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="weight" HeaderStyle-Width="15%"
                                Aggregate="Sum"
                                FooterAggregateFormatString="{0:#,##0}"
                                DataFormatString="{0:#,##0.000}"
                                HeaderStyle-HorizontalAlign="Center" 
                                HeaderText="น้ำหนัก" ItemStyle-HorizontalAlign="Right" 
                                UniqueName="weight">
                                <HeaderStyle HorizontalAlign="Center" />
                                <FooterStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn DataField="total_amount" 
                                Aggregate="Sum"
                                FooterAggregateFormatString="{0:#,##0.00}"
                                DataFormatString="{0:#,##0.00}"
                                HeaderStyle-HorizontalAlign="Center"
                                HeaderText="วงเงิน(บาท)" 
                                UniqueName="total_amount" Visible="true">
                                <HeaderStyle HorizontalAlign="Center" Width="80px"/>
                                <FooterStyle HorizontalAlign="Right" />
                                <ItemStyle HorizontalAlign="Right" />
                            </telerik:GridBoundColumn>
                        </Columns>
                        </mastertableview>
                    </telerik:RadGrid>
                </asp:Panel>
            </td>
        </tr>
    </table>
    </asp:Panel>
</td>
</tr>
</table>
<asp:DataGrid ID="grdExcel" runat="server"
    AutoGenerateColumns="true" Visible="false">
</asp:DataGrid>
</asp:Content>
